﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLogicLayer;
using Entities;

namespace project_exam
{
    public partial class FormDSHocVien : Form
    {
        public FormDSHocVien(FormMain frmMain)
        {
            InitializeComponent();
            temp = frmMain;
        }

        private HocVienBLL bllHV;
        private DataSet ds;
        private BindingSource bsHV;
        private HocVienEntity hveHV;
        FormMain temp;

        private void FormDSHocVien_Load(object sender, EventArgs e)
        {
            bllHV = new HocVienBLL();
            loadDSHV();
        }

        public void loadDSHV()
        {
            List<HocVienEntity> lstHV = new List<HocVienEntity>();
            lstHV = bllHV.getAll();
            bsHV = new BindingSource();
            bsHV.DataSource = lstHV;
            dgvDSHV.DataSource = bsHV;
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnXemThongTin_Click(object sender, EventArgs e)
        {
            HocVienEntity hv = (HocVienEntity)bsHV.Current;
            string maHV = hv.MaHocVien;
            if (maHV != null)
            {
                temp.xemHVfromDgv(maHV);
            }
            this.Close();
        }
    }
}
